import 'package:flutter/material.dart';
import '../../common/widgets.dart';
import 'loading_page.dart';

class LoadTestPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('页面测速'),
      ),
      body: Center(
        child: ListView(
          padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 8.0, bottom: 8.0),
          children: <Widget>[
            buildEntryButton(context, '长列表循环跳转', '/list_page_test/first_page'),
            buildEntryButton(
              context,
              '加载中页面测试',
              '/page_load_test/load_state_test_page',
              arguments: LoadState.LOADING,
            ),
            buildEntryButton(
              context,
              '加载失败页面测试',
              '/page_load_test/load_state_test_page',
              arguments: LoadState.LOAD_FAIL,
            ),
            buildEntryButton(context, '路由弹起对话框', '/showDialog'),
            buildButton(context, '直接弹出对话框', () => _showDialog(context)),
          ],
        ),
      ),
    );
  }

  void _showDialog(BuildContext context) {
    showDialog<void>(
      context: context,
      builder: (BuildContext context) => buildDialog(context),
    );
  }
}
